using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using DTO;

using System.Data;

namespace Business
{
    public class ThamSoService
    {




		//////////////////////////////////////////////////////////

 		                                                         

		//            Enter code your here                      //

        public static int SoLoaiPhongToiDa()
        {
            ThamSoRepository repo = new ThamSoRepository();
            return repo.SoLoaiPhongToiDa();
        }

        public static int SoKhachToiDa()
        {
            ThamSoRepository repo = new ThamSoRepository();
            return repo.SokhachToiDa();
        }
        public static double PhuThuSoLuongKhach(List<KhachHangDTO> lst)
        {
            ThamSoRepository repo = new ThamSoRepository();
            return repo.PhuThuSoLuongKhach(lst);
        }


        public static double PhuThuKhachNuocNgoai(List<KhachHangDTO> lst)
        {
            ThamSoRepository repo = new ThamSoRepository();
            return repo.PhuThuKhachNuocNgoai(lst);
        }


		                                                         

		//////////////////////////////////////////////////////////

       static public DataTable ConvertListThamSoDTOToDataTable( List<ThamSoDTO> lst)
       {
               DataTable dt = new DataTable();
           dt.Columns.Add( "MaThamSo");
           dt.Columns.Add( "TenThamSo");
           dt.Columns.Add( "GiaTri");
           dt.Columns.Add( "GhiChu");
           dt.Columns.Add( "SuDung");
           for( int i = 0; i < lst.Count; i ++)
           {
               dt.Rows.Add(
                       lst[i].MaThamSo,      
                       lst[i].TenThamSo,      
                       lst[i].GiaTri,      
                       lst[i].GhiChu,      
                       lst[i].SuDung      
                   );
           }
               return dt;
       }
        static public int GetIdentity()
        {
            Data.ThamSoRepository repo = new ThamSoRepository();
            return repo.GetIdentity();
        }

        static public int Count()
        {
            return ThamSoRepository.Count();
        }
        public static bool Them(ThamSoDTO objDTO)
        {
                ThamSoRepository repo = new ThamSoRepository();
                return repo.Them(objDTO);
        }

        public static bool Xoa(int MaThamSo, bool XoaKhoaNgoai=false)
        {
              ThamSoRepository Repo = new ThamSoRepository();
              return Repo.Xoa(MaThamSo,XoaKhoaNgoai);
        }

        public static void CapNhat(ThamSoDTO objDTO)
        {
            try
            {
                ThamSoRepository Repo = new ThamSoRepository();
                Repo.CapNhat(objDTO);
            }
            catch (System.Exception )
            {
            }
        }

        public static List<ThamSoDTO> LayDanhSach()
        {
            List<ThamSoDTO> lst = new List<ThamSoDTO>();
            try
            {
                ThamSoRepository obj = new ThamSoRepository();
                lst = obj.LayDanhSach();
            }
            catch (System.Exception )
            {
            }
            return lst;
        }

        static public List<ThamSoDTO> LayDanhSach(int Start, int Record)
        {
             Data.ThamSoRepository repo = new ThamSoRepository();
            return repo.LayDanhSach(Start, Record);
        }

        public static ThamSoDTO LayTheoMa(int MaThamSo)
        {
            ThamSoDTO objDTO = new ThamSoDTO();
            try
            {
                ThamSoRepository Repo = new ThamSoRepository();
                objDTO = Repo.LayTheoMa(MaThamSo);
            }
            catch (System.Exception )
            {
            }
            return objDTO;
        }
    }
}

